import HttpRequest from '@/api/request';
import ApiConfig from '@/api/api-config';

function getUserList(option) {//用户列表
    let url = ApiConfig.getUserList;
    return HttpRequest.requestJsonPost(url,option)
}

function getRoleSelectData(option) {//角色下拉框
    let url = ApiConfig.roleSelect;
    return HttpRequest.requestJsonPost(url,option)
}

function getUserById(option) {//获取用户信息
    let url = ApiConfig.getUserById;
    return HttpRequest.requestJsonPost(url,option)
}

function updateUserRole(option) {//修改用戶角色
    let url = ApiConfig.updateUserRole;
    return HttpRequest.requestJsonPost(url,option)
}
function addSystemUser(option) {//创建用戶角色
    let url = ApiConfig.addSystemUser;
    return HttpRequest.requestJsonPost(url,option)
}
function getAllFondsTreeData(option) {//获取全集全宗树（全量数据）
    let url = ApiConfig.getAllFondsTreeData;
    return HttpRequest.requestJsonPost(url,option)
}

// 获取所属分区下拉选数据
function getKeyName(option) {//根据全宗名获取全宗联想
    let url = ApiConfig.getKeyNameUrl;
    return HttpRequest.requestJsonPost(url,option)
}

// 添加用户 new
function saveSystemUser(option) {
    let url = ApiConfig.saveSystemUser;
    return HttpRequest.requestJsonPost(url,option)
}

// 获取证件类型 new
function getCredentialsTypeCandidates(option) {
    let url = ApiConfig.getCredentialsTypeCandidates;
    return HttpRequest.requestJsonPost(url,option)
}

//取用户相关全宗树
function getTree(params){
    let url = ApiConfig.getTree;
    return HttpRequest.requestJsonPost(url,params)
}
// 删除用户
function userInfoGetTree(params){
    let url = ApiConfig.userInfoGetTree;
    return HttpRequest.requestJsonPost(url,params)
}
// 用户启用禁用
function disabled(params){
    let url = ApiConfig.disabled;
    return HttpRequest.requestJsonPost(url,params)
}
function getRoleList(option) {//角色列表
    let url = ApiConfig.getRoleList;
    return HttpRequest.requestJsonPost(url,option)
}
// // 字典表根据类型查询
function byType() {
    let url = ApiConfig.byType+'?codeType=roleType';
    return HttpRequest.requestFormPost(url)
}
function resetPwd(params) {
    let url = ApiConfig.resetPwd;
    return HttpRequest.requestJsonPost(url,params)
}
function getRoleListByHeadquartersCode(params) {
    let url = ApiConfig.getRoleListByHeadquartersCode+'?headquartersCode='+params;
    return HttpRequest.requestJsonPost(url)
}
let Service = {
    getUserList,
    getRoleSelectData,
    getUserById,
    updateUserRole,
    getAllFondsTreeData,
    getKeyName,
    saveSystemUser, // 添加用户 new
    getCredentialsTypeCandidates,
    getTree,
    userInfoGetTree,
    disabled, //用户启用禁用
    addSystemUser,
    getRoleList,
    byType,
    resetPwd,
    getRoleListByHeadquartersCode
};

export default Service;